﻿using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;


public partial class StoredProcedures
{
	private static readonly int MaxTagsCount;



	static StoredProcedures()
	{
		using (SqlConnection conn = new SqlConnection("context connection=true"))
		{
			conn.Open();
			using (SqlCommand command = conn.CreateCommand())
			{
				command.CommandText = "SELECT Value FROM dbo.ProcedureConfigure WHERE Name=@Value";
				command.Parameters.Add(new SqlParameter("@Value", SqlDbType.NVarChar));

				command.Parameters[0].Value = "MaxTagsCount";
				string Result = (string)command.ExecuteScalar();

				try
				{
					MaxTagsCount = int.Parse(Result);
				}
				catch
				{
					MaxTagsCount = 5;
				}

				command.Parameters[0].Value = "ThresholdIndex";
				Result = (string)command.ExecuteScalar();
			}
		}
	}






	private static bool CheckString(SqlString TargetString)
	{
		if (TargetString.IsNull || TargetString.ToString().Length == 0)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
}

